<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php echo $this->_var['meta']; ?>
<link type="text/css" rel="stylesheet" href="<?php echo $this->_var['css_path']; ?>/global.css" />
<link type="text/css" rel="stylesheet" href="<?php echo $this->_var['css_path']; ?>/style.css" />
</head><body>
 
<?php echo $this->fetch('top.html'); ?>
<?php echo $this->fetch('header.html'); ?>
<div class="p2n_detail">
  <div class="p2n_detail_left">
    <div class="p2n_detail_title"> <span id="detail_title"><?php echo $this->_var['data']['name']; ?></span><span id="detail_time">发布时间：<?php echo Date::floortime($this->_var['data']['timeformat'],2); ?></span> </div>
    <div class="publisher_information">
      <div class="publisher_picture"><img src="<?php echo $this->_var['data']['avatar_path']; ?>"/>
        <p><a href="">他的主页</a></p>
      </div>
      <div class="information_content">
        <p>联系人：<?php echo $this->_var['data']['username']; ?></p>
        <p>地址：<?php echo $this->_var['data']['province']; ?><?php echo $this->_var['data']['city']; ?><?php echo $this->_var['data']['address']; ?></p>
        <p>联系方式：<?php if ($this->_var['data']['mobile_phone']): ?>手机：<?php echo $this->_var['data']['mobile_phone']; ?><?php endif; ?>&nbsp;<?php if ($this->_var['data']['telphone']): ?>固话：<?php echo $this->_var['data']['telphone']; ?><?php endif; ?></p>
        <p>悬赏金额：￥<?php echo $this->_var['data']['account']; ?></p>
        <p><span id="status" value="<?php echo $this->_var['data']['limit_time']; ?>"></span></p>
        <p style="float:right"> <span id="msg" style="color:red"></span>&nbsp;<a href="javascript:viod(0)" class="trade_colloct" title="<?php echo $this->_var['data']['name']; ?>" value='<?php echo $this->_var['data']['id']; ?>'>我要收藏</a></p>
      </div>
      
      <div class="up_picture"><img src="<?php echo $this->_var['images_path']; ?>/up_picture.png"/></div>
    </div>
    <div class="p2n_introduce">
      <div class="p2n_introduce_top">详细介绍</div>
      <div class="p2n_introduce_content">
      
      
      <?php echo $this->_var['data']['content']; ?>
      </div>
    </div>
    <div class="clear"></div>
    <div class="p2n_comment">
      <div class="p2n_comment_top">评&nbsp;&nbsp;论</div>
       <?php if ($this->_var['comments']['total'] != 0): ?>
      <?php $_from = $this->_var['comments']['list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'list');$this->_foreach['l'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['l']['total'] > 0):
    foreach ($_from AS $this->_var['list']):
        $this->_foreach['l']['iteration']++;
?>
      <div class="p2n_comment_detail" <?php if (($this->_foreach['l']['iteration'] == $this->_foreach['l']['total'])): ?>id='last_comment'<?php endif; ?>>
        <div class="user_comment_pic"><img src="<?php echo $this->_var['list']['avatar_path']; ?>"/>
          <p><a href="">他的主页</a></p>
        </div>
        <div class="comment_list">
          <p><?php echo $this->_var['list']['content']; ?></p>
          <p id="comment_list_time"><?php echo $this->_var['list']['username']; ?>&nbsp;发表于<?php echo Date::floortime($this->_var['list']['add_time'],2); ?></p>
        </div>
        <div class="clear"></div>
      </div>
    <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
     <?php else: ?>
     	<h1 >暂无</h1>
     <?php endif; ?>
     <div class="clear"></div>
     <?php echo $this->_var['comments']['page']; ?>
    </div>
    <div class="p2n_leave_message">
      <div class="p2n_leave_message_top">留&nbsp;&nbsp;言</div>
      <div class="p2n_leave_message_content">
      
      <form action="<?php echo $this->_var['site_url']; ?>trade/comments" method="post">
            <input type="hidden" name="token" value="<?php echo $this->_var['token']; ?>">
            <input type="hidden" name="trade_id" value="<?php echo $this->_var['data']['id']; ?>"/>
            <textarea id='answer_content' name='content' style='width:560px;height:160px;'></textarea>
            <tr>
              <th>验证码：</th>
              <td><input type='text' id='captcha' name='captcha' size='8' class='TEXT'/></td>
            </tr>
            <tr>
              <th>&nbsp;</th>
              <td> <?php echo $this->_var['captcha']; ?> </td>
            </tr>
            <?php if (count ( $this->_var['user'] ) > 0): ?>
            <input type='submit' value=' 我要回答 ' id="answer_click" class='rndbutton'/>
            <span class="answer_message"></span> <?php else: ?> <span id='form_msg' style=''>请先登录 <a href='<?php echo $this->_var['site_url']; ?>user/login'>点击这里</a></span> <?php endif; ?> <br/>
            <br/>
          
          </form>
      </div>
      <div class="want_leave_message">发表留言</div>
    </div>
  </div>
  <div class="p2n_detail_right">
    <div class="whether_need">
      <p>您有什么需求吗？</p>
      <a href="">免费发布信息</a> </div>
    <div class="recommend2you_first">
      <div class="recommend_hedader">
        <h3>为您推荐</h3>
        <span><a href="#">更多>></a></span></div>
      <ul class="recommend_content">
        <li>免费网站，免费为您服务推荐</li>
        <li>免费网站，免费为您推荐服务</li>
        <li>免费网站，免费为您为您推荐</li>
        <li>免费网站，免费为您为您推荐</li>
        <li>免费网站，免费为您为您推荐</li>
        <li>免费网站，免费为您为您推荐</li>
        <li>免费网站，免费为您推荐服务</li>
      </ul>
    </div>
    <img src="<?php echo $this->_var['images_path']; ?>/detail_bg.png" />
    <div class="recommend2you_second">
      <div class="recommend_hedader">
        <h3>猜您喜欢</h3>
        <span><a href="#">更多>></a></span></div>
      <ul class="recommend_content">
        <li>免费网站，免费为您为您推荐</li>
        <li>免费网站，免费为您推荐服务</li>
        <li>免费网站，免费为您为您推荐</li>
        <li>免费网站，免费为务为您推荐</li>
        <li>免费网站，免费为务为您推荐</li>
        <li>免费网站，免费服务为您推荐</li>
        <li>免费网站，免费为您推荐服务</li>
        <li>免费网站，免您服务为您推荐</li>
        <li>免费网站，为您服务为您推荐</li>
        <li>免费网站，为您为您推荐服务</li>
      </ul>
    </div>
    <img src="<?php echo $this->_var['images_path']; ?>/detail_bg.png" /> </div>
</div>
<?php echo $this->fetch('footer.html'); ?>
<script type="text/javascript" src="<?php echo $this->_var['js_path']; ?>/message.js"></script> 
<script type="text/javascript" src="<?php echo $this->_var['js_path']; ?>/jquery.validate.js"></script> 
<script type="text/javascript" src="<?php echo $this->_var['js_path']; ?>/kindeditor/kindeditor-min.js"></script>
<script>
  var editor;
  KindEditor.ready(function(K) {
	  editor = K.create('#answer_content', {
		  resizeType : 0,
		  allowPreviewEmoticons : false,
		  Width : 750,
		  filterMode : false,
		  allowImageUpload : false,
		  items : [
			  'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
			  'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
			  'insertunorderedlist', '|', 'emoticons',  'link']
	  });
  });
</script>
<script>

$(function(){
	$.ajax({
		url:'<?php echo $this->_var['site_url']; ?>trade/ajax/add_view',
		data:'id='+<?php echo $this->_var['data']['id']; ?>,
		type:'post'
	});
	
	$('.trade_colloct').click(function(){
		var id = $(this).attr('value');
		var title = $(this).attr('title');
		
		$.ajax({
		url:'<?php echo $this->_var['site_url']; ?>ajax/add_collect',
		data:'id='+id+'&type=trade&title='+title,
		type:'post',
		success:function(data){
			 $("#msg").show().html(data).fadeOut(2000);
		}		
	});
	});
	
});
      
</script>
<script type="text/javascript">
var serverTime = <?php echo $this->_var['server_time']; ?> * 1000;
$(function(){
    var dateTime = new Date();
    var difference = dateTime.getTime() - serverTime;
	
    setInterval(function(){
      $("#status").each(function(){
        var obj = $(this);
        var endTime = new Date(parseInt(obj.attr('value')) * 1000);
        var nowTime = new Date();
        var nMS=endTime.getTime() - nowTime.getTime() + difference;
        var myD=Math.floor(nMS/(1000 * 60 * 60 * 24));
        var myH=Math.floor(nMS/(1000*60*60)) % 24;
        var myM=Math.floor(nMS/(1000*60)) % 60;
		var myS=Math.floor(nMS/(1000)) % 60;
        if(myD>= 0){
			var str = "还剩："+myD+"天"+myH+"小时"+myM+"分"+myS+'秒';
        }else{
			var str = "已结束！";	
		}
		
		var timeid = $(this).attr('id');
		$('#status').html(str);
      });
    }, 100);
});
</script>
</body>
</html>
